import {
  getRouter
} from '@/utils/index'
import editRoute from './edit'
import offBudgetRoute from './offBudget'
import executeStage from './executeStage'

/**
 * 权限认证
 * Auth:
 * 无该字段 通用权限
 * super 超级管理员
 * senior 财务主管
 * middle 单位财务负责人
 * primary 单位出纳
 * ordinary 普通用户(工具人)
 * 例子：auth:Array|String = ['super', 'senior', 'middle', 'primary', 'ordinary']
 * @type {{path: string, name: string}[]}
 */
const publicRoute = [
  {
    path: '/index',
    component: getRouter('public', 'Layout'),
    meta: {
      name: '首页'
    },
    children: [
      {
        path: '/',
        name: 'homePage',
        component: getRouter('views', 'HomePage')
      },
      {
        path: '/menuHandle',
        name: 'menuHandle',
        component: getRouter('views', 'Menu'),
        meta: {
          name: '菜单操作模块'
          // auth: ['super']
        }
      },
      {
        path: '/departHandle',
        name: 'departHandle',
        component: getRouter('views', 'Depart'),
        meta: {
          name: '系别操作模块'
          // auth: ['senior']
        }
      },
      {
        path: '/roleHandle',
        name: 'roleHandle',
        component: getRouter('views', 'Role'),
        meta: {
          name: '角色操作模块'
          // auth: ['senior', 'middle']
        }
      },
      {
        path: '/userHandle',
        name: 'userHandle',
        component: getRouter('views', 'User'),
        meta: {
          name: '账号操作模块'
          // auth: ['super']
        }
      },
      {
        path: '/menuSort',
        name: 'menuSort',
        component: getRouter('views', 'Sort'),
        meta: {
          name: '菜单排序模块'
          // auth: ['super']
        }
      },
      {
        path: '/demo',
        name: 'demo',
        component: getRouter('views', 'demo')
      },
      {
        path: '/demo1',
        name: '/name1',
        component: getRouter('views', 'demo1')
      },
      // 所有报单填写(支持按需加载)
      {
        path: '/writePage/:id',
        name: 'writePage',
        component: getRouter('views', 'WritePage'),
        meta: {
          name: '报单'
        }
      },
      ...editRoute,
      ...offBudgetRoute,
      ...executeStage
    ]
  }]

export default publicRoute
